package be.ipl.finito.servlets;

import java.io.IOException;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;


/**
 * Servlet implementation class Controleur
 */
public class Controleur extends HttpServlet {
	private static final long serialVersionUID = 1L;

	/**
	 * @see HttpServlet#service(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		String nom = request.getServletPath().substring(1);
		if (nom.isEmpty())
			nom = "index.html";
		RequestDispatcher rd = getServletContext().getNamedDispatcher(nom);
		if (rd == null)
			rd = getServletContext().getNamedDispatcher("index.html");
		rd.forward(request, response);
	}

}
